//package com.invengo.communal.ui.fragment.netmodel.utils;
//
//import com.invengo.base.greendao.entity.offline.ShelfInfoBean;
//import com.invengo.library_db.entity.module_check.BookBean;//import com.invengo.base.greendao.entity.rfid.RfidBookInfo;
//import com.invengo.base.greendao.entity.BuildingStructBean;
//import com.invengo.base.greendao.entity.rfid.RfidLayerInfo;
//
//import java.util.List;
//import java.util.Optional;
//import java.util.stream.Collectors;
//
//import io.reactivex.functions.BiFunction;
//
//public class DownloadTranBeanUtils {
//    public static List<BookBean> rfidBooksList2bookBeanList(List<RfidBookInfo> rfidBookInfos) {
//        return rfidBookInfos.stream().map(rfidBookInfo -> {
//            BookBean bookBean = new BookBean();
////            bookBean.setState(rfidBookInfo.getNBookStatus());
////            String tid = rfidBookInfo.getNLabelID() == null ? "" : rfidBookInfo.getNLabelID().toUpperCase();
////            bookBean.setTid(tid);
////            bookBean.setBarCode(rfidBookInfo.getSzBookID());
////            bookBean.setNeedBackData(rfidBookInfo.getDtNeedBackDate());
////            bookBean.setItemInfoTitle(rfidBookInfo.getSzName());
////            bookBean.setCallNo(rfidBookInfo.getSzBookIndex());
////            bookBean.setLocationName(rfidBookInfo.getSzlibCD());
////            bookBean.setPretendCallNo(rfidBookInfo.getSzPretendIndexNum());
////            String rfidCaseNo = rfidBookInfo.getSzBookCaseNo();
////            bookBean.setShelfCode(rfidCaseNo);
////            bookBean.setShelfName(rfidBookInfo.getSzCaseNoTrans());
////            bookBean.setbForceSortCase(rfidBookInfo.isBForceSortCase());
//            return bookBean;
//        }).collect(Collectors.toList());
//    }
//
//    public static List<ShelfInfoBean> rfidLayerList2bookBeanList(List<RfidLayerInfo> rfidLayerInfoList) {
//        return rfidLayerInfoList.stream().map(rfidLayerInfo -> {
//            ShelfInfoBean shelfInfoBean = new ShelfInfoBean();
//            shelfInfoBean.setTid(rfidLayerInfo.getNBookCaseID());
//            shelfInfoBean.setCode(rfidLayerInfo.getSzBookCaseNo());
//            shelfInfoBean.setName(rfidLayerInfo.getSzCaseNoTrans());
//            shelfInfoBean.setLayer(rfidLayerInfo.getNLayer());
//            shelfInfoBean.setOrder(rfidLayerInfo.getNLayer());
//            shelfInfoBean.setBookCount(rfidLayerInfo.getNBookCount());
//            shelfInfoBean.setFirstBookId(rfidLayerInfo.getSzFirstBookID());
//            shelfInfoBean.setFirstBookName(rfidLayerInfo.getSzFirstBookName());
//            shelfInfoBean.setFirstBookLibCD(rfidLayerInfo.getSzFirstBookLibCD());
//            shelfInfoBean.setBookIndex(rfidLayerInfo.getSzBookIndex());
//            shelfInfoBean.setPretendIndexNum(rfidLayerInfo.getSzPretendIndexNum());
//            shelfInfoBean.setLibCD(rfidLayerInfo.getSzlibCD());
//            return shelfInfoBean;
//        }).collect(Collectors.toList());
//    }
//
//    public static class handlerLayerUserData implements BiFunction<List<BuildingStructBean>, List<ShelfInfoBean>, List<ShelfInfoBean>> {
//
//
//        @Override
//        public List<ShelfInfoBean> apply(List<BuildingStructBean> structList, List<ShelfInfoBean> needInsertList) throws Exception {
//            return needInsertList.stream().map(shelfInfoBean -> {
//                int buildNo = Integer.parseInt(shelfInfoBean.getCode().substring(0, 2));
//                int floorNo = Integer.parseInt(shelfInfoBean.getCode().substring(2, 4));
//                int roomNo = Integer.parseInt(shelfInfoBean.getCode().substring(4, 6));
//                Optional<BuildingStructBean> first = structList.stream().filter(it -> it.getBuildNo() == buildNo && floorNo == it.getFloorNo() && roomNo == it.getRoomNo()).findFirst();
//                BuildingStructBean buildingStructBean = first.get();
//                shelfInfoBean.BuildNo = buildingStructBean.getBuildNo();
//                shelfInfoBean.FloorNo = buildingStructBean.getFloorNo();
//                shelfInfoBean.RoomNo = buildingStructBean.getRoomNo();
//                shelfInfoBean.BuildingName = buildingStructBean.getBuildingName();
//                shelfInfoBean.FloorName = buildingStructBean.getFloorName();
//                shelfInfoBean.RoomName = buildingStructBean.getRoomName();
//                return shelfInfoBean;
//            }).collect(Collectors.toList());
//        }
//    }
//
//    public static List<ShelfInfoBean> handlerStructLayer(List<BuildingStructBean> structList, List<ShelfInfoBean> needInsertList){
//        return needInsertList.stream().map(shelfInfoBean -> {
//            int buildNo = Integer.parseInt(shelfInfoBean.getCode().substring(0, 2));
//            int floorNo = Integer.parseInt(shelfInfoBean.getCode().substring(2, 4));
//            int roomNo = Integer.parseInt(shelfInfoBean.getCode().substring(4, 6));
//            Optional<BuildingStructBean> first = structList.stream().filter(it -> it.getBuildNo() == buildNo && floorNo == it.getFloorNo() && roomNo == it.getRoomNo()).findFirst();
//            BuildingStructBean buildingStructBean = first.get();
//            shelfInfoBean.BuildNo       = buildingStructBean.getBuildNo();
//            shelfInfoBean.FloorNo       = buildingStructBean.getFloorNo();
//            shelfInfoBean.RoomNo        = buildingStructBean.getRoomNo();
//            shelfInfoBean.BuildingName  = buildingStructBean.getBuildingName();
//            shelfInfoBean.FloorName     = buildingStructBean.getFloorName();
//            shelfInfoBean.RoomName      = buildingStructBean.getRoomName();
//            return shelfInfoBean;
//        }).collect(Collectors.toList());
//    }
//}
